/********************************************************/
/*	Copyright (C) 2016 Gong Li Bin			*/
/*	Project:	GlbCloud			*/
/*	Author:		gong_libin			*/
/*	Date:		2012_01_12			*/
/*	File:		MrIpc.h				*/
/********************************************************/

#ifndef _MRIPC_H
#define	_MRIPC_H

#include "MrGlobal.h"
#include <sys/ipc.h>

#define	MR_IPC_PRIVATE			IPC_PRIVATE

class CMrIpc
{
public:
	CMrIpc() {};
	virtual ~CMrIpc() {};

	key_t MrIpcKey(char* pszPath, int iID)
	{
		key_t iKey = MR_FAILURE;

		iKey = ftok(pszPath, iID);
		if (MR_FAILURE == iKey) {
			MR_ERROR("%s\n", strerror(errno));
		}

		return iKey;
	}

	virtual void MrIpcDelete() { return; }
	virtual void MrIpcSetKernel() { return; }
	virtual void MrIpcInsert(void* pData) { return; }
	virtual void MrIpcDelete(void* pData) { return; }
	virtual void MrIpcUpdate(void* pData) { return; }
	virtual void* MrIpcSelect(void* pData) { return NULL; }
	virtual int MrIpcCreate(key_t iKey) { return MR_SUCCESS; }

protected:

private:

};

#endif /* _MRIPC_H */
